//
//  EmailJob.swift
//  hello
//
//  Created by 赵康 on 2024/10/19.
//
import Foundation
import Vapor
import Queues

struct Email: Codable {
		let to: String
		let subject: String
		let message: String
}

struct EmailJob: AsyncJob {
	typealias Payload = Email
	// 队列任务的主要逻辑
	func dequeue(_ context: QueueContext, _ payload: Email) async throws {
		print("Sending email to \(payload.to)")
		print("Subject: \(payload.subject)")
		print("Message: \(payload.message)")
	}
}

// 在配置文件中注册任务

// 在需要的地方调用任务
